package biz

import (
	"context"
)

type User struct {
	Hello string
}

type UserRepo interface {
	CreateUser(context.Context, *User) error
	ResolveOpenId(code string) (string, error)
	QueryAccountId(ctx context.Context, id string) (string, error)
	GenerateToken(accountId string) (string, int32, error)
}

func (uc *UserUsecase) Create(ctx context.Context, g *User) error {
	return uc.repo.CreateUser(ctx, g)
}

func (uc *UserUsecase) OpenIdResolver(code string) (string, error) {
	return uc.repo.ResolveOpenId(code)
}

func (uc *UserUsecase) QueryAccountId(ctx context.Context, openId string) (string, error) {
	return uc.repo.QueryAccountId(ctx, openId)
}

func (uc *UserUsecase) GenerateToken(id string) (string, int32, error) {
	return uc.repo.GenerateToken(id)
}
